package com.docios.cookbook2.Dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.docios.cookbook2.entity.User;

import java.util.List;

@Dao
public interface UserDao {
    @Query("SELECT * FROM user")
    List<User> getAllU();

    @Query("SELECT * FROM user WHERE id = :id")
    List<User> getAllByIdU(int id);

    @Query("SELECT * FROM user WHERE phone = :phone")
    List<User> getAllByPhoneU(String phone);

    @Insert
    long insertU(User user);

    @Delete
    void deleteU(User user);

    @Update
    void updateU(User user);

}
